package student.stu23002125.chapter10;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Demo01 {
    public static void main(String[] args) {
        File f = new File("D:\\Users\\Administrator\\IdeaProjects\\src\\student\\stu23002125\\chapter10\\stu23002125.txt");
        // 创建文件并写入内容
        try {

            FileWriter writer1 = new FileWriter(f);
            writer1.write("stu23002125");
            writer1.close();

            System.out.println("Files created: " + f.getAbsolutePath() + " and " + f.getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println(f);

    }
}
